#!/usr/bin/perl
use strict;
use warnings;
use MIME::Lite;

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = 1900 + $year;
$mon = $mon + 1;

my $filename = "$year-$mon-$mday.sql";
system("mysqldump -ututorial -p86249317lijie grouplife > /tmp/$filename");
my $title = "数据库备份$year-$mon-$mday";
my $msg = MIME::Lite->new(
        From        =>  '随你团 <noreply@suinituan.com>',
        To          =>  "250697273\@qq.com,flyingww\@gmail.com,137465897\@qq.com",
        'Reply-to'  =>  'noreply@suinituan.com',
        Subject     =>  "$title",
        Type => 'multipart/mixed',
);

$msg->attach(
        Type=>'auto',
        Path=>"/tmp/$filename"
);

$msg->send;
